package com.cryptoneedle.garden.source;

import com.cryptoneedle.garden.enums.SourceConnectType;

import java.util.Properties;

/**
 * <p>description:  </p>
 *
 * @author CryptoNeedle
 * @date 2025-06-23
 */
public abstract class AbstractDatabase {

    abstract public String getJdbcDriverClass();

    abstract protected String getJdbcUrlTemplate(SourceConnectType connectType);

    public String getJdbcUrl(SourceConnectType connectType, String host, Integer port, String route) {
        return String.format(getJdbcUrlTemplate(connectType), host, port, route);
    }

    abstract public Properties getProperties();

    abstract public String getDatabaseValidSql();

    abstract public String getDatabaseVersionSql();

    abstract public String getDatabaseStatisticSql();

    abstract public String getTableSql(String databaseName);

    abstract public String getColumnSql(String databaseName);

    abstract public String getConstraintPrimarySql(String databaseName);

    abstract public String getConstraintUniqueSql(String databaseName);

    abstract public String getConstraintForeignSql(String databaseName);

    abstract public String getConstraintCheckSql(String databaseName);

    abstract public String getIndexUniqueSql(String databaseName);

    abstract public String getDmlTrackSql(String databaseName);
}